]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
iconGrid: Move code around a bit
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 17 Aug 2014 17:44:52 +0000 (19:44 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 19 Aug 2014 17:46:45 +0000 (19:46 +0200)
The scale passed to _updateChildrenScale is exclusively computed from
properties, so it can be moved into the function itself - as the scale
now becomes a mere detail, rename to a more appropriate _updateIconSizes
at the same time.

js/ui/iconGrid.js

index 9cf9f2f788e7a20aa2d1d2be99bea2d149e95329..4c555acce8ca8ee03dff68bd2d17a6cd159cb59f 100644 (file)
@@ -524,12 +524,13 @@ const IconGrid = new Lang.Class({
 
             this._updateSpacingForSize(availWidth, availHeight);
         }
-        let scale = Math.min(this._fixedHItemSize, this._fixedVItemSize) / Math.max(this._hItemSize, this._vItemSize);
-        Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() { this._updateChildrenScale(scale); }));
+        Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
+                       Lang.bind(this, this._updateIconSizes));
     },
 
     // Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up
-    _updateChildrenScale: function(scale) {
+    _updateIconSizes: function() {
+        let scale = Math.min(this._fixedHItemSize, this._fixedVItemSize) / Math.max(this._hItemSize, this._vItemSize);
         let newIconSize = Math.floor(ICON_SIZE * scale);
         for (let i in this._items) {
             this._items[i].icon.setIconSize(newIconSize);